package scoutobahn.highway;

import java.util.Collection;

import scoutobahn.xml.OsmItem;
/**
 * A single element in the HighwayGraph.
 * @author mark
 *
 */
public class HighwayElement {
    private Collection<HighwayElement> parents;
    private OsmItem item;
    /**
     * Constructs a new Highway Element from the given OsmItem.
     * and the collection of parents
     * @param osmItem The OsmItem
     * @param belongsTo The Collection of parents that share these element
     */
    public HighwayElement(final OsmItem osmItem,
            final Collection<HighwayElement> belongsTo) {
        this.parents = belongsTo;
        this.item = osmItem;
    }
    /**
     * Get's all HighwayElements that share this HighwayElement.
     * @return The connected HighwayElement
     */
    public Collection<HighwayElement> getParents() {
        return this.parents;
    }
    /**
     * Returns the id of the HighwayElement.
     * @return Id as long.
     */
    public long getId() {
        return this.item.getId();
    }
    /**
     * Returns the OsmItem that is the database
     * of the represented HighwayElement.
     * @return OsmItem
     */
    public OsmItem getOsmItem() {
        return this.item;
    }
    @Override
    public int hashCode() {
        return this.item.hashCode() * 521;
    }
}
